<?php

class Heri_setiyawanController extends Controller {

    public function actionIndex() {
        $this->render('profile');
    }

    public function actionContact() {
        $this->render('contact');
    }

    public function actionWorks() {
        $this->render('works');
    }

    public function actionResume() {
        $this->render('resume');
    }

    public function actionProject($id) {
        $this->render('project',array('idpjx'=>$id));
    }

    public function actionCtheme($theme) {
        Yii::app()->session['app'] = array(
            'theme' => $theme,
        );
        $this->redirect($_SERVER['HTTP_REFERER']);
    }
	
	public function actionGenerate(){
		$appControllerPath = Yii::getPathOfAlias('application.controllers'); 
		$controllerName = '';
		$actionName = '';
            //checking existence of controllers directory
            if(is_dir($appControllerPath))
                $fileLists = CFileHelper::findFiles($appControllerPath);
            foreach($fileLists as $controllerPath)
            { 
                //getting controller name like e.g. 'siteController.php' 
                $controllerName .= substr($controllerPath,  strrpos($controllerPath, DIRECTORY_SEPARATOR)+1,-4); 
				$controllerName .= '<br />';
				foreach ($appControllerPath.'/'.get_class_methods(substr($controllerPath,  strrpos($controllerPath, DIRECTORY_SEPARATOR)+1,-4)) as $method_name) {
				$actionName = '';
				if (!preg_match("/^action\w+$/", $method_name)){
				$actionName .= $method_name.'<br />';
				}
				}
				$controllerName .= $controllerName.$actionName.'<br />';
            }
			
			$this->render('gen',array(
				'data'=>$controllerName,
			));
	}

    // Uncomment the following methods and override them if needed
    /*
      public function filters()
      {
      // return the filter configuration for this controller, e.g.:
      return array(
      'inlineFilterName',
      array(
      'class'=>'path.to.FilterClass',
      'propertyName'=>'propertyValue',
      ),
      );
      }

      public function actions()
      {
      // return external action classes, e.g.:
      return array(
      'action1'=>'path.to.ActionClass',
      'action2'=>array(
      'class'=>'path.to.AnotherActionClass',
      'propertyName'=>'propertyValue',
      ),
      );
      }
     */
}